import React from 'react';

class Count extends React.Component{

    add=() => {
        this.props.add(1)
    }

    subtract = () => {
        this.props.subtract(1)
    }

    render() {
        return(
            <div>
                <h3>这是count组件</h3>
                <button onClick={this.add}>+</button>
                <button onClick={this.subtract}>-</button>
                <p>这是信息{this.props.sum}</p>
            </div>
        )
    }
}

export default Count;